<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/inc/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
    <link rel="stylesheet" href="${path }/admin/css/pintuer.css"/>
    <link rel="stylesheet" href="${path }/admin/css/admin.css"/>
    <script src="${path }/public/js/jquery-1.8.2.min.js"></script>
    <script src="${path }/admin/js/pintuer.js"></script>  
</head>
<script type="text/javascript">
function del(id){
	if(confirm("您确定要删除吗?")){
		var param = {};
		param.id=id;
		$.ajax({
			type : "post",
			url :'${path}/admin/awardInfo/del.do',
			data : param,
			dataType : 'json',
			success : function(datas) {
				if(datas==1){
					alert("删除成功");
					window.location.href='${path}/admin/awardInfo/index.do';
				}else if(datas==2){
					alert("已有活动使用该奖品,建议移出后再删除");
				}
			}
		});
		
		
	}
}

function gotopage(url){
	window.location.href=url;
}


</script>
<body>
<form method="post" action="${path}/admin/awardInfo/index.do" id="form">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">奖品管理</strong></div>
    <div class="padding border-bottom">
      <ul class="search">
        <li>
        <input type="text" name="title" class="input" value="${qAwardInfo.title}" placeholder="标题"/>
        </li>
        <li>
       <%--  <select name="flag" class="input" >
          <option value="0" <c:if test="${qAwardInfo.flag eq '0' }">selected="selected"</c:if>>禁用</option>
          <option value="1" <c:if test="${qAwardInfo.flag eq '1' }">selected="selected"</c:if> >正常</option>
        </select> --%>
        </li>
        <li>
          <a class="button border-green" href="javascript:;" onclick="submitform();" ><span class="icon-search"></span> 查询</a>
        </li>
          <li>
          <a class="button border-green" href="${path}/admin/awardInfo/toupdateoradd.do" ><span class="icon-edit"></span> 添加</a>
        </li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="10%">ID</th>  
        <th width="10%">标题</th>       
        <th width="10%">图片</th>       
        <th width="10%">创建时间</th>       
        <th width="10%">操作</th>       
      </tr>      
      <c:forEach items="${page.list}" var="awardInfo" >
        <tr>
          <td>${awardInfo.id}</td>
          <td>${awardInfo.title}</td>
          <td><c:if test="${awardInfo.url!=''}">
          	<img src="${path}/upload/image/${awardInfo.url}" width="50px;" alt="${awardInfo.title}" />
          </c:if>
          </td>
          <td>${awardInfo.createTime}</td>
          <td><div class="button-group"> 
          <a class="button border-main" href="${path}/admin/awardInfo/toupdateoradd.do?id=${awardInfo.id}"><span class="icon-edit"></span> 修改</a>
          <a class="button border-red" href="javascript:void(0)" onclick="del(${awardInfo.id})"><span class="icon-trash-o"></span> 删除</a> </div>
          </td>
        </tr>
      </c:forEach>
      <tr>
        <td colspan="8">
			<jsp:include page="/WEB-INF/inc/page.jsp" flush="true"/>		
		</td>
      </tr>
    </table>
  </div>
</form>
<script type="text/javascript">


function gotopage(url){
	window.location.href=url;
}

function submitform(){
	$("#form").submit();
}
</script>
</body></html>